Find Module type

 

I create a module type and I want to find the value of the Module Type in a module.

This code give me an error message:


ModuleProperties mp



Module m = current Module



AttrDef ad = find (mp, "Module Type")   // error message ----> not associated variable


if(null ad){
    print "unavailable"
}
else{
    print ""ad.name
    }
 

 

Can somebody help me ?

 


bu12 - Mon Feb 23 07:16:57 EST 2015

Re: Find Module type
Wolfgang Uhr - Tue Feb 24 02:47:47 EST 2015

AttrDef ad = find (m, "Module Type") ?

Re: Find Module type
bu12 - Tue Feb 24 04:22:14 EST 2015

Wolfgang Uhr - Tue Feb 24 02:47:47 EST 2015

AttrDef ad = find (m, "Module Type") ?

My code give me now "LH" and other module attributes like "Last modifed on" or "Created on".

But I need only "LH".

Can somebody help me ?


ModuleProperties mp
ModuleVersion mv
string mname = "/CIBX_All/Test/Training"
string s
string sheft="LH"

mv = moduleVersion(module mname)
bool bModuleTypeExists = false

string err1 = getProperties (mv, mp)

if (!null err1){
print err1 "\n"
}


for s in mp do {

val = mp.s""

if(val!=sheft){

bool bModuleTypeExists = true

print "not exist"
}
else(!bModuleTypeExists){

print val "\n"

   }



}
 

Re: Find Module type
Mike.Scharnow - Tue Feb 24 04:36:56 EST 2015

You can try:

 

result = probeAttr_(m, "Module Type")

If this does not work, use the following:

 

string readModuleProperty(ModName_ mn, string sName) {
    ModuleProperties modProp 
    string result = null
    
    ModuleVersion mv = moduleVersion mn
    string errString = getProperties (mv, modProp) 
    delete mv
    string attrname 
    
    if (null errString) {           
        for attrname in modProp do {
            if (attrname == sName) 
                result = (modProp.sName) ""
        }
    }
    
    return result
}